package com.demo.scope;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestMyBeanFactory {
    //spring工厂
    @Test
    public void test2(){
        String xmlPath="scope/beans.xml";
        ApplicationContext applicationContext=new ClassPathXmlApplicationContext(xmlPath);
        UserService userService=applicationContext.getBean("userService",UserService.class);
        UserService userService1=applicationContext.getBean("userService",UserService.class);
        System.out.println(userService);
        System.out.println(userService1);
    }
}
